home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10678 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  46 lines

  1. Path: news.lpr.carel.fi!usenet
  2. From: Ari Lukumies <aril@cmt.lpr.mail.carel.fi>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Function Offsets
  5. Date: Tue, 19 Mar 1996 13:12:24 +0200
  6. Organization: Carelcomp Products
  7. Message-ID: <314E9698.68E9@cmt.lpr.mail.carel.fi>
  8. References: <4ih3p4$4gn@cloner4.netcom.com>
  9. NNTP-Posting-Host: renoir.cclahti.carel.fi
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (WinNT; I)
  14.  
  15. Matt Kittleson wrote:
  16. > Is this the best way to get the offset of a function?
  17. > void main()
  18. > {
  19. > void funct1()
  20. > some code here...blah...blah...blah
  21. > }
  22. > [snip]
  23.  
  24. This merely introduces the existance of function funct1. Actually, it's introduced to 
  25. main() only and that's old programming practice, and so is your format of the main 
  26. function. If you wanted the address of the function, you would want to use something 
  27. like this:
  28.  
  29.     void    funct1(void);    /* the prototype */
  30.  
  31.     int    main(void)
  32.     {
  33.         some code....
  34.  
  35.         void    (*func)(void) = funct1;    /* a variable to hold the address */
  36.     }
  37.  
  38. Later,
  39.  AriL
  40. --
  41. All my opinions are mine and mine alone.
  42.